package com.wyz.controller;

import com.alibaba.fastjson.JSON;
import com.github.pagehelper.PageInfo;
import com.wyz.entity.Teacher;
import com.wyz.service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TeacherController {

    @Autowired
    public TeacherService teacherService;

    @RequestMapping("/teacher")
    public String sum(@RequestParam(value = "pageNum",defaultValue = "1")int pageNum,String name,String document) {
        PageInfo<Teacher> page =teacherService.find(pageNum,5,name,document);
        return JSON.toJSONString(page);
    }

}
